<!--#include file="conn.asp"-->
<!--#include file="chkuser.asp"-->
<%
call adminRight(8)

ID=request("ID")
if request("action")="edit" then
	if session("SYSUserID")>1 then
		Set rs=server.CreateObject("ADODB.RECORDSET")
		sql="select * from Admin_lt_jt_wjk where id="&ID
		rs.open sql,conn,1,1
		if md5(replace(trim(request("pwd")),"'",""))<>rs("admin_Pwd_wjk") then
			alert("旧密码错误")
			GoBack()
			response.End()
		end if
		rs.close
		set rs=nothing
	end if	
	pwd=replace(trim(request("pwd2")),"'","")
	Set rs=server.CreateObject("ADODB.RECORDSET")
	sql="select * from Admin_lt_jt_wjk where id="&ID
	rs.open sql,conn,1,3
	rs("admin_Pwd_wjk")=md5(pwd)
	if session("SYSUserID")=rs("id") then
		session("SYSPwd")=md5(pwd)
	end if
	rs.update
	alert("修改成功!")
	Go("Admin_User.asp?showMsgStr=<br><b>"&rs("admin_User_wjk")&"管理员密码已修改成功！</b>|parent|3000|500||")
	rs.close
	set rs=nothing
end if
%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>修改密码</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<%
   sql="select * from Admin_lt_jt_wjk where id="&id
   Set rs = Server.CreateObject("ADODB.Recordset")
   rs.open sql,conn,1,1
%>
   <form method="post" action="?action=edit&ID=<%=ID%>" onSubmit="return Juge(this)">
    <div id="frame_Toolbar" class="toolbarBg"> 
		<a href="javascript:self.history.back();" class="icoBtn_ct"><span class="btnIco btnBack"></span>返回</a> 
		<a href="javascript:self.location.reload();" class="icoBtn_ct"><span class="btnIco btnReload"></span>刷新</a> 
		<span class="split ftSplit" ></span>
	<div id="guide" class="light_orange">请填写动态信息！</div>
	<div class="pageInfo right light_gray"></div>
    </div>
    <table class="cTable_2 table">
	<tr class="cTitle toolbarBg">
		<td width="25%"><div class="cLeftPadding">修改密码</div></td>
		<td width="75%"></td>
	</tr>
	<tr>
      <td class="tRight">用户名：</td>
	  <td><%=rs("admin_User_wjk")%></td>
	  </tr>
	  <%if session("SYSUserID")>1 then%>
	<tr>
      <td class="tRight">旧密码：</td>
	  <td><input name="pwd" type="password" id="pwd" style="width:250px;" maxlength="100" />
          <span style="color:Red;"> *</span>&nbsp;&nbsp;</td>
	  </tr>
	  <%end if%>
	<tr>
	  <td class="tRight">新密码：</td>
	  <td><input name="pwd2" type="password" id="pwd2" style="width:250px;" maxlength="100" />
        <span style="color:Red;"> *</span>&nbsp;&nbsp;</td>
	</tr>
	<tr>
	  <td class="tRight">确认密码：</td>
	  <td><input name="pwd3" type="password" id="pwd3" style="width:250px;" maxlength="100" />
        <span style="color:Red;"> *</span>&nbsp;</td>
	  </tr>
    </table>
	<%
	   rs.close
	   set rs=nothing
	%>
    <div id="cEndToolbar" class="toolbarBg">
      <div class="caButCase">
		    <input type="submit" name="Submit" value="确认修改" class="button">
	        <input type="reset" name="Submit2" value="清空重填" class="button">
      </div>
    </div>
  </form>
</body>
</html>
<script language="javascript">
function Juge(theForm)
{
	  <%if session("SYSUserID")>1 then%>
    if(theForm.pwd.value==""){  
		alert("请填写旧密码!");  
		theForm.pwd.focus();  
		return (false);  
	}
	<%end if%>
    if(theForm.pwd2.value==""){  
		alert("请填写新密码!");  
		theForm.pwd2.focus();  
		return (false);  
	}  
    if(theForm.pwd3.value==""){  
		alert("请填写确认密码!");  
		theForm.pwd2.focus();  
		return (false);  
	}  
    if(theForm.pwd2.value!=theForm.pwd3.value){  
		alert("两次密码不一致，请重新输入!");  
		theForm.pwd2.focus();  
		return (false);  
	}  
}
</script>